package com.sicau.socialpracticesystem.common.myenum;

import com.sicau.socialpracticesystem.entity.po.College;

import java.util.ArrayList;
import java.util.List;

/**
 * 学院枚举
 * @author ttxxi
 * @version : 1.0.0
 */
public enum CollegeEnum {

    JI_DIAN(1, "机电学院");

    CollegeEnum(Integer id, String college) {
        this.id = id;
        this.college = college;
    }

    /**
     * 用户类型
     */
    private final Integer id;

    /**
     * 用户类型标识
     */
    private final String college;



    public Integer getId() {
        return id;
    }


    public String getCollege() {
        return college;
    }

    public static CollegeEnum getEnum(Integer state) {
        CollegeEnum[] collegeEnums = values();
        for (CollegeEnum collegeEnum : collegeEnums) {
            if (collegeEnum.getId().equals(state)) {
                return collegeEnum;
            }
        }
        return null;
    }

    public static List<College> getAllCollage(){
        ArrayList<College> list = new ArrayList<>();
        CollegeEnum[] collegeEnums = values();
        for (CollegeEnum collegeEnum : collegeEnums) {
            College college = new College();
            college.setId(collegeEnum.getId());
            college.setCollege(collegeEnum.college);
            list.add(college);
        }
        return list;
    }
}
